package com.lby.graduation.service.impl;

import com.lby.graduation.entity.Goods;
import com.lby.graduation.mapper.GoodsMapper;
import com.lby.graduation.service.GoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 李兵耀
 * @since 2020-12-02
 */
@Service
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService {
    @Resource
    GoodsMapper goodsMapper;

    public List<Goods> showGoodsMessage() {
        return goodsMapper.showGoodsMessage();

    }

    @Override
    public List<Goods> GoodsMessageRand() {
        return goodsMapper.GoodsMessageRand();
    }

    @Override
    public List<Goods> NewGoodsMessage() {
        return goodsMapper.NewGoodsMessage();
    }

    /*用户已发布商品信息*/
    public List<Goods> selectUserGoods(Integer userId) {
        return goodsMapper.selectUserGoods(userId);

    }

    /*商品详情页信息*/
    @Override
    public List<Goods> selectGoodsByGoodsId(Integer goodsId) {
        return goodsMapper.selectGoodsByGoodsId(goodsId);
    }

    /*通过用户ID查询购物车中的商品*/
    @Override
    public List<Goods> selectCartByUserId(Integer userId) {
        return goodsMapper.selectCartByUserId(userId);
    }

    /*模糊查询*/
    @Override
    public List<Goods> findGoodsByKeyword(String type, String goodsName) {
        return goodsMapper.findGoodsByKeyword(type,goodsName);
    }


}
